<?php
/**
 * 生产订单
 */
class m_shengchandingdan extends base_m
{
    public function primarykey()
    {
        return 'id';
    }
    public function tableName()
    {
        return base_Constant::TABLE_PREFIX . 'shengchandingdan';
    }
    public function relations()
    {
        return array();
    }
    public function create($data)
    {
        if (!$data['kuanhao'] || !$data['goods_sn'] || !$data['goods_name'] || !$data['num'] || !$data['price']) {
            $this->setError(0, "缺少必要参数");
            return false;
        }
        $this->set("kuanhao", $data['kuanhao']);
        $this->set("goods_sn", $data['goods_sn']);
        $this->set("goods_name", $data['goods_name']);
        $this->set("num", $data['num']);
        $this->set("price", $data['price']);
        $this->set("created_at", date('Y-m-d H:i:s'));
        $this->set("created_uid", 0);
        $rs = $this->save($data['id']);
        if ($rs) {
            return $rs;
        }

        $this->setError(0, "保存数据失败" . $this->getError());
        return false;
    }
}
